solution of wave equation using separation of variables